//
//  FirstScrollView.m
//  B段项目
//
//  Created by dllo on 15/9/24.
//  Copyright (c) 2015年 昶博. All rights reserved.
//

#import "FirstScrollView.h"
#import "PrefixHeader.pch"
#import "FirstTableView.h"
#import "RoundTableView.h"
#import "FirstView.h"
#import <UIImageView+WebCache.h>
#import "AFNetWorkingW.h"
#import <MJRefresh.h>

@interface FirstScrollView () <UIScrollViewDelegate>


@end

@implementation FirstScrollView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        /* 设置UIScrollView属性 */
        self.contentSize = CGSizeMake(ScreenWidth * 8, 0);
        self.pagingEnabled = YES;
        self.showsHorizontalScrollIndicator = NO;
        self.bounces = NO;
        self.userInteractionEnabled = YES;
        
        
        
        for (int i = 0; i < 4; i++) {
            if (i == 0) {
//                self.urlStr = [NSString stringWithFormat:@"http://a.xcar.com.cn/interface/6.0/getNewsList.php?limit=%ld&offset=0&type=%d&ver=6.1.6", (long)                           self.limit, i + 1];
            self.roundTableView = [[RoundTableView alloc] initWithFrame:CGRectMake(i * ScreenWidth, 0, ScreenWidth, ScreenHeight -  ScreenHeight / 10 * 1.7) style:UITableViewStyleGrouped];
            self.roundTableView.urlStr = self.urlStr;
            [self.roundTableView dataHandle];
            [self addSubview:self.roundTableView];
            } else
            {
                self.urlStr = [NSString stringWithFormat:@"http://a.xcar.com.cn/interface/6.0/getNewsList.php?limit=100&offset=0&type=%d&ver=6.1.6", i + 1];
            self.firstTableView = [[FirstTableView alloc] initWithFrame:CGRectMake(i * ScreenWidth, 0, ScreenWidth, ScreenHeight -  ScreenHeight / 10 * 2.2) style:UITableViewStylePlain];
            self.firstTableView.urlStr = self.urlStr;
            [self.firstTableView dataHandle];
            [self addSubview:self.firstTableView];
            }
        }
        for (int i = 4; i < 8; i++) {
            self.urlStr = [NSString stringWithFormat:@"http://mi.xcar.com.cn/interface/xcarapp/getdingyue.php?limit=100&offset=0&type=%d&ver=6.1.7", i + 1];
            
            self.firstTableView = [[FirstTableView alloc] initWithFrame:CGRectMake(i * ScreenWidth, 0, ScreenWidth, ScreenHeight -  ScreenHeight / 10 * 2.2) style:UITableViewStylePlain];
            [self addSubview:self.firstTableView];
            
            self.firstTableView.urlStr = self.urlStr;
            [self.firstTableView dataHandle];
        }
    }
    return self;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
